home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.2 / Video Toaster v4.2.iso / arexx / editor / flyerstopframe.rexx < prev    next >
OS/2 REXX Batch file  |  1995-12-22  |  6KB  |  192 lines

  1. /* FlyerStopFrame.rexx  Grabs frames on cue from GPI trigger for stop-action animation */
  2. /* By Arnie Cachelin © 1992 NewTek Inc.                                                */
  3. /* 4.0 Flyer version by Bob Caron (Grue) © 1995 NewTek Inc.                            */
  4. /*
  5.  
  6.    This program will grab and save frames on cue from the GPI trigger.
  7.    Since the Toaster is waiting for GPI input most of the time, it will not
  8.    respond  to anything else, which you may find annoying.  You can easily
  9.    give  your Toaster GPI pulses by attaching a spare mouse or joystick to
  10.    the second mouse port then clicking the button.  You can also find long
  11.    joystick extender cables at places like Radio Shack.
  12.  
  13.    To grab frames for a claymation of stop-motion style animation, setup your
  14.    camera and 'actors', hook up a GPI trigger, and start this script with
  15.    appropriate arguments.  When your first frame is ready, hit the trigger
  16.    to grab and save it.  The toaster will then go into an 'onionskin' mode
  17.    where the camera is half dissolved over the last frame for ease of
  18.    positioning the actors.  When you hit the GPI again, the Toaster will leave
  19.    onionskin mode and grab the next frame, then return to onionskin mode.
  20.  
  21.    For best results, watch out for stray shadows, or shadows from the sun which
  22.    will change over the course of your shoot.
  23.  
  24. */
  25.  
  26. OPTIONS RESULTS
  27. call remlib('ToasterARexx.port')
  28. call remlib('PROJECT_REXX_PORT')
  29.  
  30. call addlib('PROJECT_REXX_PORT' , 0)
  31. call addlib("ToasterARexx.port" , 0)
  32.  
  33. call set_view(3)
  34. call req_error("Flyer StopFrame V3.0     ---    Create stop-frame animation as a Flyer clip.")
  35.  
  36. drive="FA0:"
  37. clip="StopMotion"
  38. num=1
  39. do while exists(drive||clip||num)
  40.    num=num+1
  41.    end
  42.  
  43. rx startfilereq("Save Clip Where?",drive,clip||num)
  44.  
  45. exit=1
  46. do while exit=1
  47.   file=queryfilereq()
  48.   if file=0 then call quit
  49.   if file~="" then exit=0
  50.   address command "c:wait 1"
  51. end
  52.  
  53. if exists(file) then
  54.    if req_tell("Ok to append to that clip?")=0 then call quit
  55.  
  56. if lastpos('/',file,length(file)-1)~=0 then do
  57.    filenam=right(file,(length(file)-lastpos('/',file,length(file)-1)))
  58.    path=left(file,(lastpos('/',file,length(file))-1))
  59.    end
  60. else do
  61.    filenam=right(file,(length(file)-lastpos(':',file,length(file)-1)))
  62.    path=left(file,(lastpos(':',file,length(file))))
  63.    end
  64.  
  65. say pragma("D",path)
  66. path=pragma("D","RAM:")
  67. name=path||filenam
  68.  
  69. call req_error("Example: 150 frames = 5 seconds.")
  70. count=0
  71. do while(count<1)
  72.    count=req_number("Number Of Frames To Grab",150)
  73.    if count="CANCEL" then call quit()
  74.    if count=0 then call quit
  75.    end
  76.  
  77. startframe=0
  78.  
  79. call req_error("Note: HQ-5 selection will only work if HQ-5 is turned on in the options panel.")
  80.  
  81. compression=-1
  82. buttons='000'
  83. do while compression=-1
  84.   buttons=req_buttons("Choose Compression:",buttons,"HQ-5","Standard","Extended")
  85.   if buttons="CANCEL" then call quit
  86.  
  87.   if buttons="100" then do
  88.      compression=3
  89.      end
  90.   if buttons="010" then do
  91.      compression=0
  92.      end
  93.   if buttons="001" then do
  94.      compression=1
  95.      end
  96. end
  97.  
  98. call req_error("")
  99.  
  100. vidinput="-1"
  101. buttons='1000'
  102. do while vidinput="-1"
  103.   buttons=req_buttons("Choose Input:",buttons,"Main 1","Main 2","Main 3","Main 4")
  104.   if buttons="CANCEL" then call quit
  105.   if buttons="1000" then do
  106.      vidinput="001"
  107.      end
  108.   if buttons="0100" then do
  109.      vidinput="002"
  110.      end
  111.   if buttons="0010" then do
  112.      vidinput="003"
  113.      end
  114.   if buttons="0001" then do
  115.      vidinput="004"
  116.      end
  117. end
  118.  
  119. if req_tell("Notice!","Make sure your GPI trigger is","connected to the 2nd mouse port.")=0 then call quit
  120. call req_error("Note: Once you begin this process you can't abort without rebooting your machine.")
  121. if req_tell("Click 'Continue' to begin.")=0 then call quit
  122.  
  123. call req_error("")
  124.  
  125. if ~exists("toaster:programs/flyer_support/c/setplaymode") then do
  126.    call req_tell("Error:","I am missing the program","'SetPlayMode' in your","Programs/Flyer_Support/c directory")
  127.    call quit()
  128.    end
  129. if ~exists("toaster:programs/flyer_support/c/AppendFields") then do
  130.    call req_tell("Error:","I am missing the program","'AppendFields' in your","Programs/Flyer_Support/c directory")
  131.    call quit()
  132.    end
  133. address command "toaster:programs/flyer_support/c/setplaymode 0 REC"
  134. Switcher(TOSW)        /* Go to Switcher screen */
  135. Switcher(M||vidinput)
  136. Switcher(P||vidinput)
  137. Switcher(LVID)
  138. Switcher(PDV1)
  139. Switcher(M||vidinput)
  140. Switcher(P||vidinput)
  141. startframe=1
  142. i=1
  143. call req_open("Hit GPI trigger to grab current frame.")
  144. call req_error("StopMotion:  Current Frame ("||right(i,3,'0')||")   Frames to go ("||((startframe+count)-1)-i||")")
  145. Switcher(SGPI,POS)    /* Set GPI trigger to positive (leading edge of pulse) */
  146. Switcher(WAIT,GPI)    /* Wait for GPI trigger to come in for first frame */
  147. Do i=startframe+1 to count
  148.   name2='"'||name||'"'
  149.   address command "toaster:programs/flyer_support/c/appendfields "||name2||" 2 "compression" >env:output"
  150.   open(state, "env:output", R)
  151.   null=readln(state)
  152.   if left(readln(state),8)="Error 33" then do
  153.     address command "toaster:programs/flyer_support/c/setplaymode 0 PLAY"
  154.     call req_error("")
  155.     call req_close()
  156.     call req_tell("Error:","        Your flyer drive is Full!")
  157.     call quit()
  158.     end
  159.   call close state
  160.   Switcher(FVID)        /* Freeze frame */
  161.   Switcher(P||vidinput)
  162.   Switcher(MDV1)
  163.   Switcher(TBAR,255)
  164.   call req_error("StopMotion:  Current Frame ("||i||")   Frames to go ("||((startframe+count)-1)-i||")")
  165.   Switcher(WAIT,GPI)    /* Wait for GPI trigger to come in */
  166.   Switcher(TAKE)
  167.   Switcher(LVID)        /* Set to live digital video */
  168.   Switcher(PDV1)
  169.   Switcher(P||vidinput)
  170.   end
  171. address command "toaster:programs/flyer_support/c/setplaymode 0 PLAY"
  172. call req_close()
  173. call req_error()
  174.  
  175. icontime=REQ_FLYERJOG("Choose frame for icon.",name,1)
  176. if icontime="CANCEL" then call quit
  177. icontime=icontime*2
  178. call MAKEICON(name,icontime)
  179.  
  180. call req_error("All done.")
  181. call req_error("")
  182. call remlib('PROJECT_REXX_PORT')
  183. call remlib('ToasterARexx.port')
  184.  
  185. exit
  186.  
  187. quit: PROCEDURE
  188.    call req_error("Canceled.")
  189.    call remlib('ToasterARexx.port')
  190.    call remlib('PROJECT_REXX_PORT')
  191.    exit
  192.